package com.dzsw.netty.future;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class FutureTask {

    public static void main(String[] args) {
        SquareCalculator cal = new SquareCalculator();
        Future f = cal.calculate(12);
        try {
//            while(!f.isDone()) {
//                System.out.println("Calculating...");
//                Thread.sleep(300);
//            }
            System.out.println(f.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
}
